//
//  TokenManager.swift
//  Kosspot
//
//  Created by 胡辉 on 2025/6/29.
//

import Foundation

class TokenManager {
    static let shared = TokenManager()
    
    var accessToken: String? {
        get { KeychainHelper.getToken() }
        set {
            if let token = newValue {
                KeychainHelper.saveToken(token)
            } else {
                KeychainHelper.deleteToken()
            }
        }
    }
    
    var isLoggedIn: Bool {
        return accessToken != nil
    }
    
    func clear() {
        accessToken = nil
    }
}
